from config import path_cfg


class RechargeApi(object):

    def __init__(self, session):
        self.session = session
        self.recharge_verify_url = path_cfg.P2P_URL + path_cfg.RECHARGE_VERIFY_URL
        self.recharge_url = path_cfg.P2P_URL + path_cfg.RECHARGE_URL

    # 获取充值验证码
    def get_img_verify_code(self, path_params):
        return self.session.get(self.recharge_verify_url + str(path_params))

    # 充值
    def recharge(self, req_body):
        return self.session.post(url=self.recharge_url, data=req_body)

    # 第三方充值
    def third_recharge(self, url, form_dict):
        return self.session.post(url=url, data=form_dict)